package entity;

import lombok.Data;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Data
public class SpecialtyEntity {
    private String id;
    private String academyId;
    private String specialtyName;
    private String specialtyCode;

    public static SpecialtyEntity mapToEntity(Map<String, Object> objectMap) {
        SpecialtyEntity specialty = new SpecialtyEntity();
        specialty.setId((String) objectMap.get("id"));
        specialty.setAcademyId((String) objectMap.get("academy_id"));
        specialty.setSpecialtyCode((String) objectMap.get("specialty_code"));
        specialty.setSpecialtyName((String) objectMap.get("specialty_name"));
        return specialty;
    }

    public static List<SpecialtyEntity> mapListToEntityList(List<Map<String, Object>> objectMapList) {
        return objectMapList.stream().map(SpecialtyEntity::mapToEntity).collect(Collectors.toList());
    }
}
